﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace MarsWorkUtility
{
    class File_OP
    {
        public string Read(string HostFile)
        {
            try
            {
                string sr_return;
                StreamReader sr = new StreamReader(HostFile);
                sr_return=sr.ReadToEnd();
                
                sr.Close();
                return sr_return;
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        public string Write(string HostFile,string HostPosition,string HostName,string HostAddr)
        {
            try
            {
                StreamWriter sw = new StreamWriter(HostFile,append:true);
                sw.WriteLine(HostPosition+"\t"+HostName+"\t"+HostAddr);
                sw.Close();
                return "";    
            }
            catch(Exception e)
            {
                throw e;
            }
        }
    }
}
